<template>
  <div id="hello">
  <h1>{{msg}}</h1>
  <h1>{{msgfromfather}}</h1>
  <button v-on:click="onClickMe">Click</button>
  </div>
</template>

<script>
export default {
  data () {
    return {
      msg: 'hello in component a!'
    }
  },
  props: ['msgfromfather'],
  events: {
    'onAddnew': function (msg) {
      this.msg = msg
    }
  },
  methods: {
    onClickMe: function () {
      console.log(this.msgfromfather)
      //  this.$emit('chid-tell-me-something', this.msg)
      //  这种方式没有成功
      this.$dispatch('chid-tell-me-something', this.msg)
    }
  }
}
</script>

<style>
.finished{
  text-decoration: underline;
}
#app {
  font-family: 'Avenir', Helvetica, Arial, sans-serif;s
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  margin-top: 60px;
}
</style>
